What is Moodboard (Digital pinboard) = ID App by Amo

Suppose you are going on vacation and you created pinboard where you will pin (photos, videos, text)

Requirements

Functional (CRUD)

1. Create. User can create the pinboard
2. Read. User can see the created pinboard
3. Update. User can add/delete/update text/video/image on pinboard
4. Delete. User can delete pinboard

Non-Functional

1. Reliable. Once board created, it should be not autoremove image,text,video on board
2. Latency: No latency in viewing/editing the Moodboard
3. Secure: Board should be visible to friends only

BOE

BW requirements not huge, User can create video(upload), then photo(upload) etc.

System APIs (CRUD)

REST API?
REST API Versioning(v1,v2)

1. Create

2. Read

3. Update

4. Delete


curl -X POST -H "Content-Type: application/json" 
-d '{"name": "board_us"}' http://127.0.0.1:8080/v1/board/create -vvv
          

curl -X GET http://127.0.0.1:8080/v1/board/get -vvv
        

curl -X PUT -H "Content-Type: application/json" -d 
'{"old_name": "board", "new_name": "NewBoard2"}' 
http://127.0.0.1:8080/v1/board/update -vvv
        

curl -X DELETE -H "Content-Type: application/json" 
-d '{"old_name": "board_us"}' 
http://127.0.0.1:8080/v1/board/delete -vvv
        

POST https://url/v1/board/create   //url=id.amo.com
header {
  Authorization: {Bearer "API_KEY_TOKEN"},

  /*Mandatory added by HTTP Start*/
  Content-len: 0                        
  Host:        //Calculated when req is sent
  UserAgent: Postman
  Accept: */*       
  Accept-Encoding: gzip, deflate, br
  Connection: Keepalive
  /*Mandatory added by HTTP End*/
}
body {  //JSON
  //Suppose travelling to US
  name: us_board
}
          

//All boards of a user
GET https://url/v1/boards
header {
  Authorization: {Bearer "API_KEY_TOKEN"},
  ..other fields..
}
body {  //JSON
  "old_name": "Board", 
  "new_name": "NewBoard2"
}
          

// Update existing board name
PUT http://url/v1/board/update
header {
  Authorization: {Bearer "API_KEY_TOKEN"},
  ..other fields..
}
          

// Delete existing board name
Delete http://url:8080/v1/board/delete
header {
  Authorization: {Bearer "API_KEY_TOKEN"},
  ..other fields..
}
body {  //JSON
  "old_name": "Board_to_be_deleted", 
  "new_name": "test"
}
        

DB Schema

Graph DB

user Table
| userid(pk) | username | created_at(timestamp) | enabled |

password Table 
| user_id(pk) | password_hash | created_at | expiry_at |

- Photos, Videos will be stored in Object Store
- Friends list, comments would be stored in Graph DB.
 
Photo Table
| photo_id(pk) | photo_url(url on object store) | user_id (fk) | comment_id |

MoodBoard Table
| moodboard_id(pk) | user_id(fk) | 
    

HLD

1. Reading moodboard
2. Updating moodboard (ie upload photo)

1 user 1 Million users
mpls
Issue Solution
Single Point of Failure
1 Application Server, 1 DB might fail
Multiple Application Servers. Autoscaling using Helm Chart
Multiple Database Replication
Scalabilty Issues On heavy load in addition to Load Balancing, Sharding would be helpful